package org.ala.distributed_transaction_commons.redis.datas;

import java.io.Serializable;
import java.util.List;
import java.util.Set;

import org.ala.distributed_transaction_commons.DistributedTransactionStatus;


/**
 * 事务环境
 *
 * @author 骆毅(ala)
 * @date 2024年2月18日
 */
public class TransactionContext implements Serializable {
	private static final long serialVersionUID = 1L;
	
	
	/**
	 * 事务id
	 */
	protected String id;
	/**
	 * 业务类型
	 */
	protected String biz;
	/**
	 * 当前参与事务的参与者id集合
	 */
	protected Set<String> participantIds;
	/**
	 * 当前参与者集合
	 */
	protected List<TransactionParticipant> participantSet;
	/**
	 * 事务当前状态
	 */
	protected DistributedTransactionStatus status;
	/**
	 * 事务开启时间戳
	 */
	protected Long startTimestamp;
	/**
	 * 在begin环节最小参与者数
	 * <p>	只有实际参与者数 >= 该数值时，协调者才会往后推进
	 * <p>	由事务协调者写入
	 */
	protected Integer minParticipantCountBegin = 1;
	/**
	 * 在canCommit环节最小参与者数
	 * <p>	只有实际参与者数 >= 该数值时，协调者才会往后推进
	 * <p>	由事务协调者写入
	 */
	protected Integer minParticipantCountCanCommit = 1;
	/**
	 * 在preCommit环节最小参与者数
	 * <p>	只有实际参与者数 >= 该数值时，协调者才会往后推进
	 * <p>	由事务协调者写入
	 */
	protected Integer minParticipantCountPreCommit = 1;
	/**
	 * 在commit环节最小参与者数
	 * <p>	只有实际参与者数 >= 该数值时，协调者才会往后推进
	 * <p>	由事务协调者写入
	 */
	protected Integer minParticipantCountCommit = 1;
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getBiz() {
		return biz;
	}
	public void setBiz(String biz) {
		this.biz = biz;
	}
	public Set<String> getParticipantIds() {
		return participantIds;
	}
	public void setParticipantIds(Set<String> participantIds) {
		this.participantIds = participantIds;
	}
	public DistributedTransactionStatus getStatus() {
		return status;
	}
	public void setStatus(DistributedTransactionStatus status) {
		this.status = status;
	}
	public Long getStartTimestamp() {
		return startTimestamp;
	}
	public void setStartTimestamp(Long startTimestamp) {
		this.startTimestamp = startTimestamp;
	}
	public List<TransactionParticipant> getParticipantSet() {
		return participantSet;
	}
	public void setParticipantSet(List<TransactionParticipant> participantSet) {
		this.participantSet = participantSet;
	}
	public Integer getMinParticipantCountBegin() {
		return minParticipantCountBegin;
	}
	public void setMinParticipantCountBegin(Integer minParticipantCountBegin) {
		this.minParticipantCountBegin = minParticipantCountBegin;
	}
	public Integer getMinParticipantCountCanCommit() {
		return minParticipantCountCanCommit;
	}
	public void setMinParticipantCountCanCommit(Integer minParticipantCountCanCommit) {
		this.minParticipantCountCanCommit = minParticipantCountCanCommit;
	}
	public Integer getMinParticipantCountPreCommit() {
		return minParticipantCountPreCommit;
	}
	public void setMinParticipantCountPreCommit(Integer minParticipantCountPreCommit) {
		this.minParticipantCountPreCommit = minParticipantCountPreCommit;
	}
	public Integer getMinParticipantCountCommit() {
		return minParticipantCountCommit;
	}
	public void setMinParticipantCountCommit(Integer minParticipantCountCommit) {
		this.minParticipantCountCommit = minParticipantCountCommit;
	}
	
}
